package mapper;

import entity.Students;
import org.mybatis.spring.SqlSessionTemplate;

public class StudentMapperImpl implements StudentMapper{
    private SqlSessionTemplate sqlSession;
    public void setSqlSession(SqlSessionTemplate sqlSession){
        this.sqlSession=sqlSession;
    }
    @Override
    public Students getStudentById(int id) {
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        return mapper.getStudentById(id);
    }

    @Override
    public int insertStudent(Students student) {
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        return mapper.insertStudent(student);
    }

    @Override
    public int updateStudent(Students student) {
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        return mapper.updateStudent(student);
    }

    @Override
    public int deleteStudent(int id) {
        StudentMapper mapper = sqlSession.getMapper(StudentMapper.class);
        return mapper.deleteStudent(id);
    }
}
